package com.softtown.modules.workflow.controller;

import com.softtown.common.annotation.LogOperation;
import com.softtown.common.utils.Result;
import com.softtown.modules.workflow.dto.SwfHstAprvDTO;
import com.softtown.modules.workflow.entity.SwfHstAprvEntity;
import com.softtown.modules.workflow.service.SwfHstAprvService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author: Dingyayong
 * @Date: 2019/9/11 16:28
 * @Description:
 */

@RestController
@RequestMapping("swf/awfHstAprv")
@Api(tags = "获取审批履历")
public class SwfHstAprvController {

    @Resource
    private SwfHstAprvService swfHstAprvService;

    /**
     * 获取待我审批中的审批历史
     *
     * @param swfHstAprvDTO 任务DTO
     * @return com.softtown.common.utils.Result<java.util.List < com.softtown.modules.entity.SwfHstAprvEntity>>
     * @Author Dingyayong
     * @Date 2020/4/13 17:03
     */
    @PostMapping("getswfHstAprvList")
    @ApiOperation("获取待我审批中的审批历史")
    @LogOperation("获取待我审批中的审批历史")
    public Result<List<SwfHstAprvEntity>> getswfHstAprvList(@RequestBody SwfHstAprvDTO swfHstAprvDTO) {
        List<SwfHstAprvEntity>
                swfHstAprvEntities = swfHstAprvService.getswfHstAprvList(swfHstAprvDTO);
        return new Result<List<SwfHstAprvEntity>>().ok(swfHstAprvEntities);
    }

    /**
     * 获取待我审批中的审批段历史
     *
     * @param swfHstAprvDTO 任务DTO
     * @return com.softtown.common.utils.Result<java.util.List>
     * @Author Dingyayong
     * @Date 2020/4/13 17:04
     */
    @PostMapping("getswfHstAprvPhaseList")
    @ApiOperation("获取待我审批中的审批段历史")
    @LogOperation("获取待我审批中的审批段历史")
    public Result<List<SwfHstAprvEntity>> getswfHstAprvPhaseList(@RequestBody SwfHstAprvDTO swfHstAprvDTO) {
        List<SwfHstAprvEntity>
                swfHstAprvEntities = swfHstAprvService.getswfHstAprvList(swfHstAprvDTO);
        return new Result<List<SwfHstAprvEntity>>().ok(swfHstAprvEntities);
    }
}
